[POWERPC][XEN] Create a cmdline.c to hold builtin/post-installed parameters.
authorHollis Blanchard <hollisb@us.ibm.com>
Wed, 4 Oct 2006 22:22:59 +0000 (17:22 -0500)
committerHollis Blanchard <hollisb@us.ibm.com>
Wed, 4 Oct 2006 22:22:59 +0000 (17:22 -0500)
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : %80%27K%ED%86%CA%17I%FE%29%E2%21G%CB%C7%C4%95%22%271

xen/arch/powerpc/Makefile
xen/arch/powerpc/boot_of.c
xen/arch/powerpc/cmdline.c [new file with mode: 0644]
xen/include/asm-powerpc/config.h

index c25a8964ad48a39969c1f1d12a68284013faebce..32a049c001e6423064c2f287052912785af3d105 100644 (file)
@@ -9,6 +9,7 @@ obj-y += audit.o
 obj-y += backtrace.o
 obj-y += bitops.o
 obj-y += boot_of.o
+obj-y += cmdline.o
 obj-y += dart.o
 obj-y += dart_u3.o
 obj-y += dart_u4.o
@@ -75,10 +76,11 @@ physdev.o: ../x86/physdev.c
 
 HDRS += $(wildcard *.h)
 
+ifneq ($(CMDLINE),)
 # The first token in the arguments will be silently dropped.
-IMAGENAME = xen
-CMDLINE = ""
-boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
+FULL_CMDLINE := xen $(CMDLINE)
+endif
+cmdline.o: CFLAGS += -DCMDLINE="\"$(FULL_CMDLINE)\""
 
 TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,0x400000,-T,xen.lds
 TARGET_OPTS += start.o $(ALL_OBJS)
index 8e5ff97e1a9ea127981ec10ec76a7a2896b0c83a..623944b557876e2ec107e1b60f60f2c0b6bc9197 100644 (file)
@@ -16,6 +16,7 @@
  * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Jimi Xenidis <jimix@watson.ibm.com>
+ *          Hollis Blanchard <hollisb@us.ibm.com>
  */
 
 #include <xen/config.h>
@@ -40,12 +41,8 @@ volatile unsigned int __spin_ack;
 static ulong of_vec;
 static ulong of_msr;
 static int of_out;
-static char bootargs[256];
-
-#define COMMAND_LINE_SIZE 512
-static char builtin_cmdline[COMMAND_LINE_SIZE]
-    __attribute__((section("__builtin_cmdline"))) = CMDLINE;
 
+extern char builtin_cmdline[];
 extern struct ns16550_defaults ns16550;
 
 #undef OF_DEBUG
@@ -464,15 +461,17 @@ static void boot_of_bootargs(multiboot_info_t *mbi)
 {
     int rc;
 
-    rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs));
-    if (rc == OF_FAILURE || bootargs[0] == '\0') {
-        strlcpy(bootargs, builtin_cmdline, sizeof(bootargs));
+    if (builtin_cmdline[0] == '\0') {
+        rc = of_getprop(bof_chosen, "bootargs", builtin_cmdline,
+                CONFIG_CMDLINE_SIZE);
+        if (rc > CONFIG_CMDLINE_SIZE)
+            of_panic("bootargs[] not big enough for /chosen/bootargs\n");
     }
 
     mbi->flags |= MBI_CMDLINE;
-    mbi->cmdline = (u32)bootargs;
+    mbi->cmdline = (ulong)builtin_cmdline;
 
-    of_printf("bootargs = %s\n", bootargs);
+    of_printf("bootargs = %s\n", builtin_cmdline);
 }
 
 static int save_props(void *m, ofdn_t n, int pkg)
diff --git a/xen/arch/powerpc/cmdline.c b/xen/arch/powerpc/cmdline.c
new file mode 100644 (file)
index 0000000..e7c1bdf
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+ */
+
+#include <asm/config.h>
+
+char builtin_cmdline[CONFIG_CMDLINE_SIZE] 
+        __attribute__((section("__builtin_cmdline"))) = CMDLINE;
index 154938fe4df3624458019d593e3ff62660c73e56..b3b3671c1d810adac1d612f6b21f039d4daa1bbe 100644 (file)
@@ -50,6 +50,7 @@ extern char __bss_start[];
 #define CONFIG_GDB 1
 #define CONFIG_SMP 1
 #define CONFIG_PCI 1
+#define CONFIG_CMDLINE_SIZE 512
 #define NR_CPUS 16
 
 #ifndef ELFSIZE